<?php
ob_start();
var_dump($someVar);
$result = ob_get_clean();
file_put_contents("log.txt", $result);
?>